<?php
/**
 *@author Connor <caokang@foxmail.com>
 *@todo
 *@link www.zeevin.com
 */
?>
<div class="title">
<h3>设置</h3>
</div>
<div class="main_content">
<form id='set' method='post' action="">
    <div class="base_set">
        <div class="base_set_list">
        <ul>
        <li><p>收信邮箱提醒</p>
            <ul><?php echo CHtml::activeRadioButtonList($model, 'alert_setting', User::getAlert(),array('separator' =>'<li>'));?></ul>
    	</li>

       <li style="border:none;"><p>个人界面是否对外显示</p>
             <ul><?php echo CHtml::activeRadioButtonList($model, 'space_privacy', User::getPrivacy(),array('separator' =>'<li>', ));?></ul>
       </li>
       </ul>
        
        </div>
        <div class="storage"><span class="left subsave" >保存设置</span>
            <span class="right" tag=<?php echo User::STAFF_STATUS_DISABLE;?> <?php if($model->status==User::STAFF_STATUS_DISABLE):?>style="display: none;"<?php endif;?>><a href="javascript:void(0);" class="switch"  title="暂停之嗅账号">暂停之嗅账号</a></span>
            <span class="right" tag=<?php echo User::STAFF_STATUS_NORMAL;?> <?php if($model->status==User::STAFF_STATUS_NORMAL):?>style="display: none;"<?php endif;?>><a href="javascript:void(0);" class="switch"  title="暂停之嗅账号">激活之嗅账号</a></span>
        </div>
        </div>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() { 


    $('#set').submit(function(){
    // prepare Options Object 
    var options = { 
    // target:'#topmsg', 
    success: function(data) { 
            var msg='设置保存失败';
            if(data=='0')msg='设置保存成功';
            $('#topmsg').html(msg)
            $('#showmsg').show();
            showDialog();
            setTimeout(function(){$('#showmsg').hide();},1000);
        }
    } ;
        $(this).ajaxSubmit(options);
        return false; 
    });
    $('.subsave').click(function(){$('#set').submit();})
    


    $(".switch").parent('.right').click(function(){
    var val = $(this).attr('tag');
    $.post('?r=Setting',{'User':{'status':val}},
        function(data) { 
            var msg='设置保存失败';
            if(data=='0'){msg='设置保存成功';$('.switch').parent('.right').toggle();}
            $('#topmsg').html(msg)
            $('#showmsg').show();
            showDialog();
            setTimeout(function(){$('#showmsg').hide();},1000);
        })
    })
}); 



</script>